/* 
 * Copyright (c) 2022, CENTRIN.CIYUN.LTD. All rights reserved.
 */
package com.cory.admin.sys.utils;

import java.util.List;
import com.cory.admin.sys.domain.entity.SysUser;
import com.cory.admin.sys.service.SysUserService;
import com.cory.boot.utils.SpringUtils;

/**
 * @author xiongcong
 * @date 2022-01-18
 */
public class AdminUtils {
    static final int EXPIRETIME = 15 * 60;

    public static String getSysUserName(Integer userId) {
        SysUser user = getSysUser(userId);
        if (user != null) {
            return user.getUserName();
        }
        return null;
    }
    
    public static SysUser getSysUser(Integer userId) {
        SysUser user = SpringUtils.getBean(SysUserService.class).getByCache(userId);
        if (user != null) {
            return user;
        }
        return null;
    }
    
    public static List<SysUser> listSysUserByIds(List<Integer> userIds) {
        return SpringUtils.getBean(SysUserService.class).getByIds(userIds);
    }
}
